﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="vHCS.Web.MdlHR.Controls.HR_ctrEmpHeader" Codebehind="HR_ctrEmpHeader.ascx.cs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Core.Controls" Namespace="Core.Controls.DataReader" TagPrefix="core" %>
<div class="div6Column">
    <div class="label">
            <asp:Label ID="lblEmpcode_L" runat="server" Text="Mã nhân viên"></asp:Label>
    </div>
    <div class="control">
        <asp:TextBox ID="txtEmpCode" runat="server" Text="" Width="80%" CssClass="inputTextUserSearch" onkeypress="KeypreessEnter_EmpCode(this,event)"></asp:TextBox>
        <asp:Button ID="btnChooseEmpCode" runat="server" Width="15%" Text="..." 
            OnClientClick="popupMangerEmpHeader.OpenSelectEmployeePopup();return false;"  />
    </div>
    <div class="label">
            <asp:Label ID="lblFullName_L" runat="server" Text="Họ tên"></asp:Label>
    </div> 
    <div class="control">
        <asp:TextBox ID="txtFullName" runat="server" Text="" Width="80%" CssClass="inputTextUserSearch" onkeypress="KeypreessEnter_EmpName(this,event)"></asp:TextBox>
         <asp:Button ID="Button1" runat="server" Width="15%" Text="..." 
            OnClientClick="popupMangerEmpHeader.OpenSelectEmployeePopup();return false;"/> 
    </div>
    <div class="label">
            <asp:Label ID="lblUsername_L" runat="server" Text="Tên đăng nhập"></asp:Label>
    </div>
    <div class="controlLast">
        <telerik:RadComboBox ID="cboUsername"  AutoPostBack="true"
              EnableLoadOnDemand="true" Filter="None" 
             DataSourceID="dtsUserList" DataTextField="Id" DataValueField="Id"
              HighlightTemplatedItems="true" DropDownWidth="400"
             runat="server" Width="100%" onitemsrequested="RadComboBox_ItemRequested" 
            onselectedindexchanged="cboUsername_SelectedIndexChanged">
             <HeaderTemplate>
                <ul class="comboHeader">
                    <li class="code">
                        <asp:Label ID="Label2" runat="server" Text="Mã"></asp:Label>
                    </li>
                    <li class="name">
                        <asp:Label ID="Label3" runat="server" Text="Tên người dùng"></asp:Label>
                    </li>
                    <li class="divClear"></li>
                </ul>
            </HeaderTemplate>
            <ItemTemplate>
                <ul class="comboItem">
                    <li class="code">
                        <%#DataBinder.Eval(Container.DataItem, "Id")%>
                    </li>
                    <li class="name">
                        <%#DataBinder.Eval(Container.DataItem, "Name")%>
                    </li>
                </ul>
            </ItemTemplate>
             <FooterTemplate>
                    <div class="comboFooter">
                        <asp:Label ID="Label4" runat="server" Text="Please enter text to show more items"></asp:Label>
                    </div>                   
               </FooterTemplate>
        </telerik:RadComboBox>
        <core:coredatasource ID="dtsUserList"  runat="server" SelectMethod="GetComboItemsPer" 
        TypeName="vHCS.SYS.Business.SYS_UsersCollection" 
        CacheExpirationPolicy="Sliding"
        EnableCaching="false"  MaximumRowsParameterName="">
            <SelectParameters>
                <asp:Parameter DbType="String" DefaultValue="" Name="prefix" />
                <asp:Parameter DbType="Boolean" DefaultValue="true" Name="addNullItem" />
                <asp:Parameter DbType="Boolean" DefaultValue="true" Name="getTop" />
                <asp:ControlParameter Name="FunctionId" ControlID="hdfFuntionId" PropertyName="Value" DbType="Int64" />
            </SelectParameters>
        </core:coredatasource>    
    </div>
    <div class="divClear"></div>
</div>


<div class="div6Column">
    <div class="label">
        <asp:Label ID="lblOrgChart_L" runat="server" Text="Cơ cấu tổ chức"></asp:Label>
    </div>
    <div class="div5Colum">
        <asp:TextBox  ID="txtOrgChart" runat="server" Text=""  Enabled="true" ReadOnly="true"  Width="99.5%" CssClass="inputReadOnly"></asp:TextBox>
    </div>
    <div class="divClear"></div>
</div>

     
<div id="advancedSearch" style="width:100%; display:block" >
    <div class="div6Column">
        <div class="label"><asp:Label ID="lblCareerChart" runat="server" Text="Cơ cấu chuyên môn"></asp:Label></div>
        <div class="div5Colum"><asp:TextBox ID="txtProJob" runat="server" Text="" Enabled="true" ReadOnly="true"  Width="99.5%" CssClass="inputReadOnly"></asp:TextBox></div>
    </div>
    <div class="divClear"></div>
    <div class="div6Column">
        <div class="label"><asp:Label ID="Label1" runat="server" Text="Cơ cấu quản lý"></asp:Label></div>
        <div class="div5Colum"><asp:TextBox  ID="txtMgtJob" runat="server" Text="" Enabled="true" ReadOnly="true"  Width="99.5%" CssClass="inputReadOnly"></asp:TextBox></div>
    </div>
    <div class="divClear"></div>
    <div class="div6Column">
        <div class="label"><asp:Label ID="lblEmpType_L" runat="server" Text="Loại nhân viên" ></asp:Label></div>
        <div class="control"><asp:TextBox ID="txtEmpType" runat="server" Text="" CssClass="inputReadOnly"  ReadOnly="true" Width="100%"></asp:TextBox></div>
        <div class="label"><asp:Label ID="lblContractType_L" runat="server" Text="Loại hợp đồng"></asp:Label></div>
        <div class="control"><asp:TextBox ID="txtContractType" runat="server" Text="" CssClass="inputReadOnly" ReadOnly="true" Width="100%"></asp:TextBox></div>
        <div class="label"><asp:Label ID="lbllocation_L" runat="server" Text="Văn phòng làm việc"></asp:Label></div>
        <div class="controlLast"><asp:TextBox ID="txtWorkingOffice" runat="server" Text="" CssClass="inputReadOnly" ReadOnly="true" Width="99.5%" ></asp:TextBox></div>
    </div>
    <div class="divClear"></div>

    <div class="div6Column">
        <div class="label"><asp:Label ID="lblLevel_L" runat="server" Text="Cấp bậc"></asp:Label></div>
        <div class="control"><asp:TextBox ID="txtJobLevel" runat="server" Text="" CssClass="inputReadOnly" ReadOnly="true" Width="100%"></asp:TextBox></div>
        <div class="label"><asp:Label ID="lblJobtilte_L" runat="server" Text="Chức vụ"></asp:Label></div>
        <div class="control"><asp:TextBox ID="txtJobTitle" runat="server" Text=""  ReadOnly="true" Width="100%" CssClass="inputReadOnly"></asp:TextBox></div>
        <div class="label"><asp:Label ID="lblReportFor_L" runat="server" Text="Báo cáo cho"></asp:Label></div>
        <div class="controlLast"><asp:TextBox ID="txtReportTo" runat="server" Text="" ReadOnly="true"  CssClass="inputReadOnly" Width="99.5%" ></asp:TextBox></div>
    </div>
    <div class="divClear"></div>

    <div class="div6Column">
        <div class="label"><asp:Label ID="lblStartDate_L" runat="server" Text="Ngày vào công ty" Width="100%"></asp:Label></div>
        <div class="control"><asp:TextBox ID="txtJoinDate" runat="server" Text="" Enabled="true" Width="100%" ReadOnly="true" CssClass="inputReadOnly"></asp:TextBox></div>
        <div class="label"><asp:Label ID="lblStatus_L" runat="server" Text="Tình trạng"></asp:Label></div>
        <div class="control">
             <asp:RadioButtonList Enabled="false" ID="rbtActive" runat="server" RepeatDirection="Horizontal">
               <asp:ListItem Value="1" Text="Hiện diện"></asp:ListItem>
               <asp:ListItem Value="0" Text="Nghỉ việc"></asp:ListItem>             
            </asp:RadioButtonList>        
        </div>
        <div class="label"><asp:Label ID="lblBarcode_L" runat="server" Text="Barcode"></asp:Label></div>
        <div class="controlLast">
            <asp:TextBox ID="txtBarcode" runat="server" Text="" Enabled="true" Width="99.5%" CssClass="inputReadOnly" ReadOnly="true" ></asp:TextBox>
            <%--<asp:Button ID="Button2" runat="server" Width="15%" Text="..." 
            OnClientClick="popupMangerEmpHeader.OpenSelectEmployeePopup();return false;" />--%>
        </div>
    </div>
     <div class="divClear"></div>
</div>

<div class="divAdvanced">
   <div class="sep">
           
    </div>
    <div class="label">
        <asp:HyperLink ID="btnExpand" runat="server" onclick='return collapser.showAdvance("1");' ToolTip="Click here to expand" CssClass="divCollapsed">Mở rộng</asp:HyperLink>
        <asp:HyperLink ID="btnCollapse" runat="server"  onclick='return collapser.hideAdvance("1");' ToolTip="Click here to collapse"  CssClass="divExpanded">Thu nhỏ</asp:HyperLink>
        <div style="display:none">
            <asp:TextBox ID="hdfAdvanceStatus" runat="server" Text="0"></asp:TextBox>
        </div>      
    </div>
    
    <div class="divClear"></div>

<asp:HiddenField ID="hdfAutoLoad" Value="0" runat="server" />
<asp:HiddenField ID="hdfEmployeeId" Value="" runat="server" />
<asp:HiddenField ID="hdfReportingline" Value="" runat="server" />
<asp:HiddenField ID="hdfFuntionId" Value="" runat="server" />
<div style="display:none">
    <asp:Button ID="btnEmpChanged" runat="server" Text="" OnClick="EmployeeChanged" />
</div>
<script type="text/javascript">
    var collapser = new CollapseExpand("<%=btnExpand.ClientID %>", "<%=btnCollapse.ClientID %>", "advancedSearch", "<%=hdfAdvanceStatus.ClientID %>");
    var popupMangerEmpHeader = new EmpHeaderFormPopupManager();

    //Set trang thái hiển thị vùng thông tin mở rộng
    collapser.onInit();

    function EmpHeaderFormPopupManager() {
        this.OpenSelectEmployeePopup = function () {
            var callerId = "<%=base.MasterFuntionId %>";
            new PopUpManager().Open("../MdlHR/Controls/HR_PopEmpSelecting.aspx?IsPopup=1&mChoice=0&Caller=" + callerId + "");
        }
    }

    //Xử lý sự kiện nhấn phím enter của empcode và empname
    function KeypreessEnter_EmpName(sender, event) {
        var keyPressed;
        if (window.event)
            keyPressed = window.event.keyCode; // IE
        else
            keyPressed = event.which; // Firefox

        if (keyPressed == 13) {
            var callerId = "<%=base.MasterFuntionId %>";
            var txtEmpName = document.getElementById("<%=txtFullName.ClientID %>");
            new PopUpManager().Open("../MdlHR/Controls/HR_PopEmpSelecting.aspx?IsPopup=1&mChoice=0&Caller=" + callerId + "&Barcode=" + "&EmpName=" + encodeURI(txtEmpName.value) + "&EmpCode=&KeyPress=1");
            window.event.cancel = true;
            
        }
    }

    function KeypreessEnter_EmpCode(sender, event) {
        var keyPressed;
        if (window.event)
            keyPressed = window.event.keyCode; // IE
        else
            keyPressed = event.which; // Firefox
        if (keyPressed == 13) {
            var callerId = "<%=base.MasterFuntionId %>";
            var txtCode = document.getElementById("<%=txtEmpCode.ClientID %>");
            new PopUpManager().Open("../MdlHR/Controls/HR_PopEmpSelecting.aspx?IsPopup=1&mChoice=0&Caller=" + callerId + "&Barcode=" + "&EmpName=" + "&EmpCode=" + encodeURI(txtCode.value) + "&KeyPress=1");
            window.event.cancel = true;
        }
    }
    function KeypreessEnter_UserName(sender, event) {
        var keyPressed;
        if (window.event)
            keyPressed = event.keyCode; // IE
        else
            keyPressed = event.which; // Firefox
        if (keyPressed == 13) {
            var callerId = "<%=base.MasterFuntionId %>";
            var cboUser = $find("<%=cboUsername.ClientID %>");
            new PopUpManager().Open("../MdlHR/Controls/HR_PopEmpSelecting.aspx?IsPopup=1&mChoice=0&Caller=" + callerId + "&Barcode=" + "&EmpName=" + "&EmpCode=" + "&UserName=" + cboUser.get_text() + "&KeyPress=1");
            window.event.cancel = true;
        }
    }

    ///Xử lý sự kiện chọn nhân viên
    function ReturnEmployee(args) {
        if (args != null && args.length > 0) {
            var hdfEmpId = document.getElementById("<%=hdfEmployeeId.ClientID %>");
            //Nếu thay đổi mã nhân viên
            hdfEmpId.value = args[0];
            var btnChanged = document.getElementById("<%=btnEmpChanged.ClientID %>");                
            btnChanged.click();
        }
    }
</script>

</div>